# -*- coding: utf-8 -*-
# backend/core/websocket_config.py
from pydantic_settings import BaseSettings
from typing import List, Dict, Any


class WebSocketSettings(BaseSettings):
    """WebSocket配置"""
    
    # 连接限制
    max_connections_per_user: int = 5  # 每个用户最大连接数
    max_total_connections: int = 1000  # 总连接数限制
    
    # 消息限制
    max_message_size: int = 10 * 1024  # 10KB
    max_messages_per_minute: int = 60  # 每分钟最大消息数
    
    # 心跳设置
    ping_interval: int = 30  # ping间隔（秒）
    ping_timeout: int = 90   # ping超时（秒）
    
    # 频道设置
    max_channels_per_connection: int = 10  # 每个连接最大频道数
    
    # 项目房间设置
    max_users_per_project: int = 50  # 每个项目最大用户数
    
    # 重连设置
    max_reconnect_attempts: int = 5   # 最大重连尝试次数
    reconnect_delay: int = 5          # 重连延迟（秒）
    
    # 日志设置
    log_all_messages: bool = False    # 是否记录所有消息
    log_connection_events: bool = True # 是否记录连接事件
    
    class Config:
        env_prefix = "WEBSOCKET_"
        env_file = ".env"


websocket_settings = WebSocketSettings()
